#ifndef _INPUT_MANAGER_H
#define _INPUT_MANAGER_H

#include "SFML\Graphics.hpp"
#include "Joystick.h"
#include <memory>
#include <vector>

class InputManager
{
public:
	InputManager(std::shared_ptr<sf::RenderWindow> window);
	~InputManager(void);

	bool capture();

	bool isMouseButtonDown(unsigned int button) const { return _mouseButtons[button]; }
	bool isMouseButtonPressed(unsigned int button) const;
	bool isMouseButtonReleased(unsigned int button) const;

	bool isKeyDown(unsigned int key) const { return _keys[key]; }
	bool isKeyPressed(unsigned int key) const;
	bool isKeyReleased(unsigned int key) const;

	bool isJoystickBtnDown(unsigned int joystickId, unsigned int button);
	bool isJoystickBtnPressed(unsigned int joystickId, unsigned int button);
	bool isJoystickBtnReleased(unsigned int joystickId, unsigned int button);
	
	sf::Vector2i _mousePosition;
private:
	bool _keys[sf::Keyboard::KeyCount];
	bool _lastKeys[sf::Keyboard::KeyCount];
	bool _mouseButtons[sf::Mouse::ButtonCount];
	bool _lastMouseButtons[sf::Mouse::ButtonCount];
	bool _joystick[sf::Joystick::Count][sf::Joystick::ButtonCount];
	bool _lastJoystick[sf::Joystick::Count][sf::Joystick::ButtonCount];
	std::shared_ptr<sf::RenderWindow> _window;
	std::vector<CJoystick> _joysticks;
	
};

#endif // _INPUT_MANAGER_H

